package com.hut.oa.model.bean;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * 申请流程记录
 * @author 朱嘉茵
 *
 */
@Table(name="apply_record")
@Entity
public class ApplyRecord {
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="ar_id")
	private Long id;//申请记录id
	
	@Column(name="ar_content",nullable=false)
	private String content;//记录内容
	
	@Column(name="ar_time",nullable=false)
	private Date time=new Date();//记录时间
	
	@JoinColumn(name="ar_user_id",nullable=false)
	@OneToOne(cascade=CascadeType.REFRESH)
	private User user;//操作人
	
	@JoinColumn(name="ar_apply_id",nullable=false)
	@ManyToOne
	private Apply apply;//申请表

	public ApplyRecord() {
		super();
		// TODO Auto-generated constructor stub
	}

	public ApplyRecord(String content, User user, Apply apply) {
		super();
		this.content = content;
		this.user = user;
		this.apply = apply;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Apply getApply() {
		return apply;
	}

	public void setApply(Apply apply) {
		this.apply = apply;
	}

	@Override
	public String toString() {
		return "ApplyRecord [id=" + id + ", content=" + content + ", time=" + time + "]";
	}
	
}
